package com.example.skilltest.dao;

import com.example.skilltest.entity.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface EmployeeDAO {
    @Select("select * from adm_employee where employee_id = #{id}")
    Employee getEmpById(@Param("id")int id);

    @Select("<script>"+
            "select * from adm_employee "+
            "where employee_id in "+
            "<foreach item='id' index='index' collection='ids' open='(' separator=',' close=')'>" +
            "#{id}"+
            "</foreach>"+
            "order by cts"+
            "</script>")
    List<Employee> getEmpListByIds(@Param("ids")List<Integer> ids);
}
